package com.controller;

import com.domain.EnterPrise;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.env.Environment;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/books")
public class BookController {
    @Value("${lesson}")
    private String lesson;
    @Value("${server.port}")
    private Integer port;
    @Autowired
    private Environment environment;

    @Autowired
    private EnterPrise enterPrise;

    @GetMapping("/{id}")
    public String getById(@PathVariable Integer id){
        System.out.println("id==>"+id);
        System.out.println(lesson);
        System.out.println(port);
        System.out.println(environment.getProperty("lesson"));
        System.out.println(environment.getProperty("enter.age"));
        System.out.println(enterPrise);
        return "hello ,spring boot";
    }

}
